package algorithm_demo.leetcode;

/**
 * 1480. 一维数组的动态和
 * <a href="https://leetcode.cn/problems/running-sum-of-1d-array/">https://leetcode.cn/problems/running-sum-of-1d-array/</a>
 * @author Api
 * @date 2023/5/11 0:16
 */
public class Problem_1480_RunningSumof1dArray {
    public int[] runningSum(int[] nums) {
        int[] prefix = new int[nums.length];
        prefix[0] = nums[0];
        for(int i = 1; i< nums.length; i++){
            prefix[i] = prefix[i-1]+nums[i];
        }
        return prefix;
    }
}
